To access the file localname on the remote machine machine you would specify the filename /machine:localname. This will connect to machine and transfer the file using the default method. See Default Method.
Some examples of tramp filenames are shown below.
melancholia.daniel on the machine melancholia.
The ~<user>
construct is expanded to the home directory of that user on the
remote machine.melancholia.machine can also be an IPv4 or IPv6 address, like in /127.0.0.1:.emacs or /[::1]:.emacs. For syntactical reasons, IPv6 addresses must be embedded in square brackets [ and ].
Unless you specify a different name to use, tramp will use the current local user name as the remote user name to log in with. If you need to log in as a different user, you can specify the user name as part of the filename.
To log in to the remote machine as a specific user, you use
the syntax /user
@machine:path/to.file. That means that
connecting to melancholia as daniel and
editing .emacs in your
home directory you would specify /daniel
@melancholia:.emacs.
It is also possible to specify other file transfer methods (see Inline methods, see External methods) as part of the filename. This is done by putting the method before the user and host name, as in /method: (Note the trailing colon). The user, machine and file specification remain the same.
So, to connect to the machine melancholia as
daniel, using the ssh method to transfer files, and edit
.emacs in my home
directory I would specify the filename /ssh:daniel
@melancholia:.emacs.
Finally, for some methods it is possible to specify a different port number than the default one, given by the method. This is specified by adding #<port> to the host name, like in /ssh:daniel @melancholia#42:.emacs.